package com.xiaotao.service.impl;
import com.xiaotao.entity.Coupon;
import com.xiaotao.mapper.CouponMapper;
import com.xiaotao.service.CouponService;
import com.xiaotao.util.ResponseEnum;
import com.xiaotao.util.ResponseUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

@Service
public class CouponServiceImpl implements CouponService {
    @Resource
    private CouponMapper couponMapper;
    @Override
    public ResponseUtil queryAll() {
        List<Coupon> coupons = couponMapper.queryAll();
        return coupons!=null ? ResponseUtil.get(ResponseEnum.OK,coupons):
                ResponseUtil.get(ResponseEnum.FAIL);
    }
    @Override
    public ResponseUtil queryById(Integer id) {
        Coupon coupon = couponMapper.queryById(id);
        return coupon!=null ? ResponseUtil.get(ResponseEnum.OK,coupon):
                ResponseUtil.get(ResponseEnum.FAIL);
    }
}
